package com.xhh.nphm.system.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xhh.nphm.system.domain.AppealCate;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface AppealCateMapper extends BaseMapper<AppealCate> {
    @Select("select * from appealCate where CodePK=#{codepk}")
    AppealCate selectByCodePk(String codepk);


    /**
     * 内容分类列表数据
     * @param appealCate
     * @return
     */
    @Select("select CodePK,SortName,CodeParent,OrdNum,case when EndFlag=0 then 'closed' else 'open' end as state from appealCate where isDel=0 and UseFlag=1 and CodePK>11 [[AND SortName =#{sortname}]] ORDER BY CodeParent,OrdNum ")
    List<AppealCate> contentSortJson(AppealCate appealCate);
    @Update("UPDATE appealCate SET IsDel=1 WHERE CodePK=#{codepk}" )
    int deleteByCodePk(String codepk);
}
